home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tool-inc.zip / GETFDATE.INC < prev    next >
Text File  |  1989-06-02  |  1KB  |  47 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. (*
  14.  * given a valid filename, returns modification date and time
  15.  * formatted as a string:  yy/mm/dd hh:mm
  16.  *
  17.  *)
  18.  
  19. function get_file_date (filename:      anystring): anystring;
  20. var
  21.    DirInfo:     SearchRec;
  22.    Stamp:       DateTime;
  23.  
  24.    function strval (i: integer): string;
  25.    begin
  26.       strval := chr(((i div 10) mod 10) + ord('0')) +
  27.                 chr((i mod 10) + ord('0'));
  28.    end;
  29.  
  30. begin
  31.    FindFirst(filename,$21,DirInfo);
  32.    if (DosError <> 0) then
  33.       get_file_date := 'No such file'
  34.    else
  35.  
  36.    begin
  37.       UnpackTime(DirInfo.time, Stamp);
  38.       get_file_date := strval(Stamp.Year) + '/' +
  39.                        strval(Stamp.Month)+ '/' +
  40.                        strval(Stamp.Day) + ' ' +
  41.                        strval(Stamp.Hour) + ':' +
  42.                        strval(Stamp.Min);
  43.    end;
  44. end;
  45.  
  46.  
  47.